In [1]:
import numpy as np
from bokeh.plotting import figure
from bokeh.io import show, output_notebook, save
In [2]:
output_notebook()
In [3]:
N = 10000
x = np.random.normal(0, np.pi, N)
y = np.sin(x) + np.random.normal(0, 0.2, N)
p = figure(output_backend="webgl")
p.scatter(x, y, alpha=0.1)
show(p)
In [4]:
!conda list | egrep "jupyter|notebook"
In [5]:
p = figure(plot_height=200, sizing_mode='scale_width')
p.scatter(x, y, alpha=0.1)
show(p)
In [6]:
N = 4000
x = np.random.random(size=N) * 100
y = np.random.random(size=N) * 100
radii = np.random.random(size=N) * 1.5
colors = [
"#%02x%02x%02x" % (int(r), int(g), 150) for r, g in zip(50+2*x, 30+2*y)
]
TOOLS="hover,crosshair,pan,wheel_zoom,zoom_in,zoom_out,box_zoom,undo,redo,reset,tap,save,box_select,poly_select,lasso_select,"
p = figure(tools=TOOLS, sizing_mode='scale_width')
p.scatter(x, y, radius=radii,
fill_color=colors, fill_alpha=0.6,
line_color=None)
show(p)
In [9]:
save(p, 'color_scatter.html')
Out[9]:
In [ ]: